Client/server desynchronization
page should at some point in time be merged with [http://technical-minecraft.wikia.com/wiki/Server/Client_Communication Server/Client Communication ] A lot of things in the game are calculated independently from something called the server, and something called the client. In singleplayer there will always be only one server and one client. In muliplayer, there is always one server in total, and one client per online player. Ghost blocks (Desynchronized Block) The server and client calculate independently, where which block should be at any given point in time. If a block only exists for the client, and is an air block for the server, it is called a ghost block. The theory behind ghost blocks If a block is present for the client, but not for the server, this is commonly referred to as a ghost block. These blocks have many interesting properties, and they are luckily also possible to fully automate using many different designs. A player standing on a ghost block is essentially flying to the server. The server regards the player as flying in the middle of the air, while the client regards it as standing on a solid block. This means that the server is continuously increasing the players downwards velocity more and more every tick, until terminal velocity is reached. A glitch exists, where this downwards velocity may be utilised. If a player takes damage, a velocity update packet is sent, most likely as a result of the knockback calculations. If the player is standing on a ghost slime block, the slime block reverses the players velocity, sending the player up into the air, while the downwards momemtum is still retained. However, if the player is standing on a solid slime block, the launching still happens but the velocity is reset. This means that slime block elevator repeater stations are possible to create, but require complex ghost block generator setups to work. Ghost block elevators Many ghost block based elevator designs have been created. * Slime block glitch - https://www.youtube.com/watch?v=ulh6-HvscTo ** The original slime block elevator by test137e29 where ghost blocks are not utilised, but boats are used to build up negative velocity. * Exponentially bouncy slime blocks - https://www.youtube.com/watch?v=PiHz4gVWnTQ * Ghost Elevator - https://www.youtube.com/watch?v=sFAlX7TKz1s ** The first proper slime block elevator to use ghost blocks instead of boats to acquire velocity. * Ghost block elevator repeater station prototype - http://gfycat.com/RepulsiveUnfinishedKinglet ** A prototype design for ghost block repeater stations posted to /r/technicalminecraft. Invisible blocks When a block exists for the server but not for the client, this is an invisible block to the client. Standing on one will create jittery effects. Some ghost blocks generators may create these blocks, and vice-versa. Disguised blocks When a block is different for the server, than for the client, then it´s called a disguised block. For example a block is disguised, if it´s an iron block for the client, but a diamond block for the server. Technically ghost blocks and invisible blocks are also disguised blocks, where the block is an air block on either the client or the server side. Interestingly, a disguised block will transform into an invisible block, if its an instantmineable block clientside, but a non-instantmineable block serverside, and the block is instant-mined. Ghost block generators The most popular ghost block generator was first shown by Myren Eario on YouTube. His design uses a zero-off-tick-pulse which creates a piston in a special state, which is then pushed by a piston. Compact Ghost Block Generator and related stuff When a piston that is being pushed in below an extending piston head is powered using a zero tick, the piston head that was first extended decides which block is turned into an invisible block. This is very strange behaviour. You can have a normal piston facing up, and a sticky piston facing the other way, and the normal piston arm will act like a sticky piston, pulling the block for the client only. Ghost mode (Desynchronized Entity Position) It is also possible for the players position to be out of sync with the server, and this may often span over longer periods of time, and be caused deliberately, causing what is commonly known as the ghost mode. In this mode the player and server are out of sync, causing many strange effects. For example, the client is able to freely roam the world, while the server thinks the player is staying stationary in one place. Throwing items while the client is desynchronized with the server means that the items will be thrown where the server thinks the player is, and not where the client thinks it is. This is often used for testing whether one has actually entered the ghost mode or not. Desynchronized boats A common example of the ghost mode is boats getting desynchronized. This often happens randomly, but it can also be forced. For example, if a boat is placed on a top slab, it will sometimes glitch slightly into the block. At that point, the boat may glitch through the slab. This results in an invisible boat sitting on top of the slab, and a client-side only boat entity below the boat. The client side boat can move, but it will move the invisible boat at the same time. However, the invisible boat may be moved independently from the client side boat using pistons. If the invisible boat is moved using water streams pushing into a wall, the client side boat will move independently, and this is the basic principle behind flying, controllable boats.Controllable flying boats Ghost motion (Desynchronized Player Motion) The motion of the player gets calculated independently from the server and the client. Also clientside motion and serverside motion have different effects on the player. The clientside motion, will change the position of the player in every tick. The serverside motion also moves the player every tick, however within the same game tick after being moved by serverside motion, the position of the player is reset to the position he was in before he was moved by the serverside motion. Therefore most players won´t notice their serverside motion. However the player will have enough time (with time being a 0 tick / update order -notion) to activate pressure plates or tripwire, get damaged by cactus or lava, or pick up items in the position he was temporarily moved in by the serverside motion. Ghost motion refers to any kind of motion, that exists serverside, but not clientside. The following methods allow a player to get ghost motion: Standing next to an entity At some point in time before minecraft 1.5 (This might need to be more exact, but who cares), players used to be pushed around by other entities. This was officially removed. However it has only been removed for the client, and not for the server. So if a player stands directly next to a mob, the player will not get any actual clientside motion anymore, and therefore his position won´t change, but the player will still get serverside motion. Since this is a motion, that does not exist clientside, but only serverside, it´s ghost motion. If the player is standing next to a high amount of mobs at once, he will get a high amount of ghost motion, and will be able to activate pressure plates multiple blocks away from his actual position. Standing on top of a purely clientside appearance If a player is standing on the clientside position of a boat in ghost mode, or if a player is standing on a ghost block, he will get downwards serverside motion, since there´s serverside no ground underneath his feet and the player is supposed to fall down, if there´s no ground below him. However clientside the player will not fall down, since the client thinks, the player is standing on a boat or a block. Therefore the player gets a downwards ghost motion, and will be able to activate pressure plates below the ghost block or desynchronized boat he´s standing on. If the player waits for a few seconds, he will be able to gain a high amount of ghost motion, since he continually gets falling motion. It caps at a terminal velocity of roughly 3,92 blocks/tick of serverside motion. The ghost motion damage bug Due to a bug in the game, the serverside motion of a player will overwrite the clientside motion, if the player takes damage. This means that, if a player has ghost motion and takes damage, he will suddenly get actual motion. Since most methods to gain ghost motion give the player a very high amount of ghost motion, the player can also get very high amounts of actual clientside motion, if he takes damage while having a lot of ghost motion. Code behind the damage bug When an entity is attacked, and it is not invulnerable, the entity gets its attribute velocityChanged set to true. If the velocity is changed, a new S12PacketEntityVelocity packet is sent to the client. The velocity packet is received on the client side. All velocity related calculations then happen, and if the player is standing on a ghost slime block, he is launched up into the air. If the player lands on a normal block, the velocity is reset, but if the player lands on a ghost block, the server still thinks the player is flying with an enormous negative y momentum, causing him to bounce up once again. If the player starts at a normal slime block, his velocity is not saved. Other desynchronizations Ghost Light If a ghost block is a light emitting block, it will emit light clientside, but not serverside. Blocks in ghost light will appear as bright as they would look in normal light. The F3 screen also shows the brightness the client thinks a block has. But even though the blocks look bright, hostile mobs will still be able to spawn. This also works the other way around: If a light emitting block is an invisible block, it will look like it emits no light clientside, and the F3 screen will detect low light levels, but hostile mobs will not be able to spawn and ice can melt. References Category:Redstone